package com.example.applicationview;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;

import com.example.applicationview.anim.ActivityTweenAnimation;
import com.example.applicationview.anim.ActivityPropertyAnimation;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    public void rubberActivity(View view) {
        //通过action隐式启动
        Intent intent = new Intent("com.example.applicationview.RubberActivity");
        startActivity(intent);
    }

    public void viewGroup(View view) {
        Intent intent = new Intent(this, MyViewGroupActivity.class);
        startActivity(intent);
    }

    public void anim(View view) {
        Intent intent = new Intent(this, ActivityTweenAnimation.class);
        startActivity(intent);
    }

    public void valueAnim(View view) {
        Intent intent = new Intent(this, ActivityPropertyAnimation.class);
        startActivity(intent);
    }

    public void kotlinActivity(View view) {
        Intent intent = new Intent(this, KotlinActivity.class);
        startActivity(intent);
    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            //应用到后台
            moveTaskToBack(true);
            return true;
        }
        return super.onKeyDown(keyCode, event);
    }

}
